<template>
  <div class="deNumber">
    <div class="deNumTop" v-for="(list, index) of deData" :key="index">
      <span class="deNums">购买数量</span>
      <div class="de-all">
        <span class="de-red iconfont" @click="reduce(index)">&#xe630;</span>
        <input class="de-text" type="text" v-model="list.homeValue" readonly="readonly">
        <span class="de-add iconfont" @click="add(index)">&#xe61e;</span>
      </div>
    </div>
    <div class="deNumWord" @click="show=!show">
      <div class="de-info">
        <i class="iconfont de-gou">&#xe605;</i>
        <span class="de-title">支持花呗分期</span>
      </div>
      <div class="de-huan">
        <i class="iconfont de-gou">&#xe605;</i>
        <span class="de-title">支持以旧换新</span>
      </div>
      <div class="de-forwords">
        <i class="iconfont fors">&#xe74f;</i>
      </div>
    </div>
    <!-- 遮盖层 -->
    <transition name='fade'>
      <div class="de-layer" v-show='show'>
        <div class="layer">
          <div class="layer-header">
            <div class="layer-left"></div>
            <div class="layer-title">服务说明</div>
            <i class="iconfont layer-right" @click="close">&#xe608;</i>
          </div>
          <div class="layer-content">
            <div class="layer-info">
              <div class="layer-info-top">
                <i class="iconfont layer-info-icon">&#xe605;</i>
                <h3>支持花呗分期</h3>
              </div>
              <p class="layer-info-content">
                商品支持花呗分期
              </p>
            </div>
            <div class="layer-info">
              <div class="layer-info-top">
                <i class="iconfont layer-info-icon">&#xe605;</i>
                <h3>可以使用换新鼓励金</h3>
              </div>
              <p class="layer-info-content">
                换新鼓励金通过参加以旧换新回收旧手机以后获得，旧手机享受额外补贴。
                <span class="layer-iphone">
                  现在换机
                </span>
              </p>
            </div>
          </div>
          <div class="layer-footer">
              <p class="layer-close" @click="close">关闭</p>
          </div>
        </div>
      </div>
    </transition>
  </div>
</template>

<script>
export default {
  props: {
    deData: Array
  },
  data() {
    return {
      show: false
    }
  },
  methods: {
    // 商品减少
    reduce: function(index){
      // console.log(this.deData[index].homeValue)
      if(this.deData[index].homeValue == 1){
          this.deData[index].homeValue = 1
      }else{
          this.deData[index].homeValue--
      }
    },
    // 商品增加
    add: function(index){
      this.deData[index].homeValue++
    },
    // 显示弹出层
    // shows(){
    //   alert('123');
    // },
    // 隐藏弹出层
    close(){
      this.show = false
    }
  },
}
</script>

<style lang="less">
  .deNumber{
    width: 100%;
    box-sizing: border-box;
    background: white;
    .deNumTop{
      width: 100%;
      height: 1.4rem;
      border-bottom: 1px solid #eee;
      padding: 0 .2rem;
      font-size: .26rem;
      .deNums{
        width: 2rem;
        height: 1.4rem;
        line-height: 1.4rem;
        float: left;
        font-size: .4rem;
      }
      .de-all{
        float: left;
        line-height: .6rem;
        margin-top: .3rem;
        .de-red{
              width: .8rem;
              border: 1px solid #B2B2B2;
              float: left;
              font-size: .36rem;
              height: .8rem;
              line-height: .8rem;
              text-align: center;
              border-right: none;
              color: #B2B2B2;
        }
        .de-text{
          border: 1px solid #B2B2B2;
          float: left;
          width: 1rem;
          height: .8rem;
          line-height: .8rem;
          text-align: center;
        }
        .de-add{
            width: .8rem;
            border: 1px solid #B2B2B2;
            float: left;
            font-size: .36rem;
            height: .8rem;
            line-height: .8rem;
            text-align: center;
            border-left:none;
            color: #B2B2B2;
        }
      }
    }
    .deNumWord{
      width: 100%;
      height: 1.2rem;
      border-bottom: 1px solid #eee;
      font-size: .3rem;
      .de-info{
        margin-left: .2rem;
        width: 3rem;
        height: 1.2rem;
        line-height: 1.2rem;
        float: left;
        .de-gou{
          color: #18A2E2;
          font-size: .23rem;
        }
        .de-title{
          font-size: .2rem;
        }
      }
      .de-huan{
        float: left;
        width: 3rem;
        height: 1.2rem;
        line-height: 1.2rem;
        .de-gou{
          color: #18A2E2;
          font-size: .23rem;
        }
        .de-title{
          font-size: .2rem;
        }
      }
      .de-forwords{
        float: right;
        margin-right: .2rem;
        line-height: 1.2rem;
        font-size: .3rem;
        .fors{
          font-size: .5rem;
          color: #828282;
        }
      }
    }
    .de-layer{
      position: fixed;
      top: 0;
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, .5);
      z-index: 3;
      .layer{
        position: fixed;
        bottom: 0;
        width: 100%;
        height: 8rem;
        background: white;
        .layer-header{
          width: 100%;
          height: 1.5rem;
          border-bottom: 1px solid #eee;
          .layer-left{
            width: 10%;
            height: 100%;
            float: left;
          }
          .layer-title{
            width: 80%;
            height: 100%;
            float: left;
            text-align: center;
            line-height: 1.5rem;
            font-size: .6rem;
          }
          .layer-right{
            width: 10%;
            height: 100%;
            float: left;
            line-height: 1.5rem;
            font-size: .6rem;
          }
        }
        .layer-content{
          width: 100%;
          .layer-info{
            width: 100%;
            .layer-info-top{
              width: 100%;
              height: 0.8rem;
              margin: 0.5rem 0 0 0.3rem;
              line-height: .8rem;
              .layer-info-icon{
                float: left;
                color: #18A2E7;
              }
              h3{
                float: left;
                margin-left: .1rem;
                font-size: .5rem;
              }
            }
            .layer-info-content{
              margin: .2rem .2rem 0.1rem 0.6rem;
              font-size: 0.36rem;
              line-height: 0.5rem;
               .layer-iphone{
                color:#18A2E7;
              }
            }
          }
        }
        .layer-footer{
          position: absolute;
          bottom: 0;
          width: 100%;
          height: 1.4rem;
          border-top: 1px solid #eee;
          .layer-close{
            width: 90%;
            height: 1rem;
            margin: 0.2rem auto;
            text-align: center;
            line-height: 1rem;
            color: white;
            border-radius: 0.625rem;
            background: #18A2E2;
            font-size: .42rem;
          }
        }
      }
    }
  }
  .fade-enter-active, .fade-leave-active{
    transition: all .3s ease;
  }
  .fade-enter, .fade-leave-to{
    transform: translateY(100%);
  }
</style>
